package me.caofeng.dao;

import me.caofeng.enums.ItemStatus;
import me.caofeng.enums.Role;
import me.caofeng.pojo.Category;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Copyright © 2017曹峰. All rights reserved.
 *
 * @Prject: mall
 * @Package: me.caofeng.dao
 * @Description:
 * @Author: 曹峰 blog.caofeng.me
 * @Date: 2017-06-19 22:13
 * @Version: V1.0
 */
@Repository
public interface CategoryMapper {
    Category getCategory(@Param("id") Integer id ,
                         @Param("status") Integer status,
                         @Param("parentId" ) Integer parentId,
                         @Param("role") Integer role);

    List<Category> getCategories(
            @Param("id") Integer parentId,
            @Param("status") Integer status,
            @Param("role") Integer role);

    int addCategory(@Param("category") Category category);

    Integer isCategoryExists(@Param("id") Integer id);

    int deleteCategory(@Param("id") Integer id, @Param("status")ItemStatus status);

    int updateCategory(@Param("id") Integer id,
                       @Param("name") String name ,
                       @Param("status") ItemStatus status ,
                       @Param("parentId") Integer parentId,
                       @Param("sortOrder") Integer sortOrder);
}
